package org.lifei.base.util;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class AjaxResult {
    private Boolean success;
    private String msg;
    private Object data;

    public static AjaxResult success(){
        AjaxResult ajaxResult = new AjaxResult();
        ajaxResult.success = true;
        ajaxResult.msg ="操作成功";
        return ajaxResult;
    }
    public static AjaxResult success(Object data){
        AjaxResult ajaxResult = new AjaxResult();
        ajaxResult.success = true;
        ajaxResult.msg ="操作成功";
        ajaxResult.data = data;
        return ajaxResult;
    }
    public static AjaxResult error(){
        AjaxResult ajaxResult = new AjaxResult();
        ajaxResult.success = false;
        ajaxResult.msg ="操作失败";
        return ajaxResult;
    }
    public static AjaxResult error(String msg){
        AjaxResult ajaxResult = new AjaxResult();
        ajaxResult.success = false;
        ajaxResult.msg =msg;
        return ajaxResult;
    }
}
